package cn.com.pingpp;

import java.io.File;
import java.util.HashMap;
import java.util.Map;

/**
 * ClassName: PingppConfig
 * 
 * @Description: ping++的工具类
 * @author yewl
 * @date 2017年3月8日
 */
public class PingppConfig {

	/**
	 * Ping++ API BASE URL
	 */
	public static final String LIVE_API_BASE = "https://api.pingxx.com";
	/**
	 * version
	 */
	public static final String VERSION = "2.2.1";
	/**
	 * api key
	 */
	public static volatile String apiKey = "sk_live_9qnLGS5iX94GnTujXD1CWj9C";

	public static volatile String apiVersion;

	public static volatile String appId = "app_i50yLC0KaDaTr98m";

	public static String AcceptLanguage = "zh-CN";

	private static volatile boolean verifySSL = true;
	private static volatile String apiBase = LIVE_API_BASE;

	public static volatile String privateKey = "-----BEGIN RSA PRIVATE KEY-----\n"
			+ "MIICXQIBAAKBgQDt2iRTCOQ4h5A5wHoPfhPoF/5f13ilj0Z1d42oCrnXUaFk7aW6\n"
			+ "NVQa7rUB8qjujeU2PbykzbNgyOpTgZtfsohFrgjMpuEEtyo/0Z1EGTk7kE8fJzWw\n"
			+ "mzrMsDstR13WLMeRkwHdaIz/h35pwSoWb5k2kjdOkyzEenKGemjiTo3J8wIDAQAB\n"
			+ "AoGAfjCn6O3ktyElIZ6+o42OXiqsqIiW16+GADhnjWnzYwtKB1QWAw7cClXu7pOh\n"
			+ "kL7zhq2GciE4M/ckax1uI32C0f8k84eqrrrQEhB/DULHJolCoi+jvaIpSxSnenYV\n"
			+ "u9qsuxjBGuc9IjU8/2/P1JBAUjDBTY1Rd9xmOhVUCepviNECQQD+0UD5ZQnu/m+b\n"
			+ "jZo2bncanNBPDQBvc7OSLioPn3w2dQZqb3fcBHMXxj4J/vp60iW/jox/pNpCyUeL\n"
			+ "0bE/nq0fAkEA7vS7VstvQ1e7iFpWbIejwHLNOt0I5FLVGffBdSWTlFXyYwtxBHiT\n"
			+ "XopxkQkAp6ACyB6eEXoBaSrEL1KA5Ue0rQJBAMhKQFEHi0RQt/dD2Vg5geLoKZBJ\n"
			+ "PvNbtWUMZkE7cc34NB/LGCJXWQPx7ee7hLSvo74q1OKr+GcQgO002KaSGa8CQQCe\n"
			+ "pJAzwYAu33I7xm4WQ78tp4oliFW88FlWkiw4ECh4lM8FfrUb2MlOPO/E8IskvpDa\n"
			+ "N6mNxMhm/+Ob31R/5ClJAkBoWwMS4Um7Dc5J5htY23m/ytB08vjmTx+uPkVPpUiB\n"
			+ "poatMdKtH/c3MBuUIr4H/bAgN9FeHjwOpcCIGeXbUYLF\n" + "-----END RSA PRIVATE KEY-----";
	public final static String privateKeyPath = File.separator + "sm_rsa_private_key.pem";
	// private final static String privateKeyFilePath =
	// File.separator+SystemPath.getClassPath()+"res"+
	// File.separator+"rsa_private_key.pem";

	public static Boolean DEBUG = false;

	public final static Map pingChanelmap = new HashMap() {
		{
			put("alipay", "alipay");
			put("alipay_wap", "alipay_wap");
			put("alipay_pc_direct", "alipay_pc_direct");
			put("alipay_qr", "alipay_qr");
			put("bfb", "bfb");
			put("bfb_wap", "bfb_wap");
			put("cp_b2b", "cp_b2b");
			put("upacp", "upacp");
			put("upacp_wap", "upacp_wap");
			put("upacp_pc", "upacp_pc");
			put("wx", "wx");
			put("wx_pub", "wx_pub");
			put("wx_pub_qr", "wx_pub_qr");
			put("wx_wap", "wx_wap");
			put("wx_lite", "wx_lite");
			put("yeepay_wap", "yeepay_wap");
			put("jdpay_wap", "jdpay_wap");
			put("fqlpay_wap", "fqlpay_wap");
			put("qgbc_wap", "qgbc_wap");
			put("cmb_wallet", "cmb_wallet");
			put("applepay_upacp", "applepay_upacp");
			put("mmdpay_wap", "mmdpay_wap");
			put("qpay", "qpay");
			put("alipay_wap", "alipay_wap");
		}
	};

	// alipay 支付宝 APP 支付
	// alipay_wap 支付宝手机网页支付
	// alipay_pc_direct 支付宝即时到账支付，即支付宝 PC 网页支付
	// alipay_qr 支付宝当面付，即支付宝扫码支付
	// bfb 百度钱包移动快捷支付，即百度钱包 APP 支付
	// bfb_wap 百度钱包手机网页支付
	// cp_b2b 银联企业网银支付，即 B2B 银联 PC 网页支付
	// upacp 银联支付，即银联 APP 支付（2015 年 1 月 1 日后的银联新商户使用。若有疑问，请与 Ping++ 或者相关的收单行联系）
	// upacp_wap 银联手机网页支付（2015 年 1 月 1 日后的银联新商户使用。若有疑问，请与 Ping++ 或者相关的收单行联系）
	// upacp_pc 银联网关支付，即银联 PC 网页支付
	// wx 微信 APP 支付
	// wx_pub 微信公众号支付
	// wx_pub_qr 微信公众号扫码支付
	// wx_wap 微信 WAP 支付（此渠道仅针对特定客户开放）
	// wx_lite 微信小程序支付
	// yeepay_wap 易宝手机网页支付
	// jdpay_wap 京东手机网页支付
	// fqlpay_wap 分期乐支付
	// qgbc_wap 量化派支付
	// cmb_wallet 招行一网通
	// applepay_upacp Apple Pay
	// mmdpay_wap 么么贷
	// qpay QQ 钱包支付

	/**
	 * (FOR TESTING ONLY) If you'd like your API requests to hit your own
	 * (mocked) server, you can set this up here by overriding the base api URL.
	 */
	public static void overrideApiBase(final String overriddenApiBase) {
		apiBase = overriddenApiBase;
	}

	/**
	 * (FOR TESTING ONLY) Only disable SSL verification if you're using your own
	 * (mocked) server. Disabling verification on pingxx.com is not supported
	 */
	public static void setVerifySSL(boolean verify) {
		verifySSL = verify;
	}

	/**
	 * get SSL state
	 *
	 * @return true is set SSL ,false is not set SSL
	 */
	public static boolean getVerifySSL() {
		return verifySSL;
	}

	/**
	 * get api url
	 *
	 * @return String api url
	 */
	public static String getApiBase() {
		return apiBase;
	}

	/**
	 * set api url
	 *
	 * @param apiBase
	 */
	public static void setApiBase(String apiBase) {
		PingppConfig.apiBase = apiBase;
	}

	public static void main(String args[]) {
		System.out.println(PingppConfig.class.getResourceAsStream("sm_rsa_private_key.pem"));
		System.err.println(System.getProperty("sm_rsa_private_key.pem"));
	}
}
